import requests
def get_xiaohongshu_trend(day):
    res= requests.post("https://gw.newrank.cn/api/xh/xdnphb/nr/app/xhs/trend/trendDot", 
  headers={
    "accept": "*/*",
    "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7",
    "content-type": "application/json",
    "n-token": "35c430ef650b459ba2b9c1409148d929",
    "request_id": "a9ab2e25fb204fcd8c21a4c34585a74a",
    "sec-ch-ua": "'Google Chrome';v='113', 'Chromium';v='113', 'Not-A.Brand';v='24'",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "'macOS'",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-site",
    "cookie": "sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22nr_1300ddi3x%22%2C%22first_id%22%3A%2218924db0cdec7-0db19ea82365c48-1c525634-1296000-18924db0cdf1eb3%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22%24device_id%22%3A%2218924db0cdec7-0db19ea82365c48-1c525634-1296000-18924db0cdf1eb3%22%7D; token=E2EF94D274B14EEEBA8EFD4FF60A7448; acw_tc=781bad2416918087426828593e42c15137fefd8ed9c72da05d6dab76b9d859",
    "Referer": "https://xh.newrank.cn/",
    "Referrer-Policy": "strict-origin-when-cross-origin"
  },
  json={'time':'30','startTime':'','endTime':'','searchType':'all','sentiment':'','type':'interactiveCount','req':[{
    "must": [
        "《天道》"
    ],
    "mustNot": ["轮回",'酬勤','修仙','火影','忍者','漫画','修','游戏','神'],
    "should": []
}]},
)
    resj = res.json()['data']
    return resj
import json
json.dump(get_xiaohongshu_trend(30), open('src/data/xiaohongshu_trend.json', 'w', encoding='utf-8'), ensure_ascii=False)